package com.musichord.core.unit.chord;

import java.util.Vector;

import com.musichord.core.helper.MidiInfo;

public class TexturePattern {
	private Vector<Vector<TextureNote>> pattern;
	private int duration;

	public TexturePattern() { // default constructor
		/* notes for the 1st pitch of a chord */
		Vector<TextureNote> NoteList0 = new Vector<TextureNote>();
		NoteList0.add(new TextureNote(0, MidiInfo.DEFAULT_VELOCITY, 4, 0));

		/* notes for the 2nd pitch of a chord */
		Vector<TextureNote> NoteList1 = new Vector<TextureNote>();
		NoteList1.add(new TextureNote(2, MidiInfo.DEFAULT_VELOCITY, 4, 4));

		/* notes for the 3rd pitch of a chord */
		Vector<TextureNote> NoteList2 = new Vector<TextureNote>();
		NoteList2.add(new TextureNote(4, MidiInfo.DEFAULT_VELOCITY, 4, 8));

		/* notes for the 4th pitch of a chord */
		Vector<TextureNote> NoteList3 = new Vector<TextureNote>();
		NoteList3.add(new TextureNote(3, MidiInfo.DEFAULT_VELOCITY, 4, 12));

		pattern = new Vector<Vector<TextureNote>>();
		pattern.add(NoteList0);
		pattern.add(NoteList1);
		pattern.add(NoteList2);
		pattern.add(NoteList3);

		duration = 16;
	}

	public Vector<Vector<TextureNote>> getPattern() {
		return pattern;
	}

	public int getDuration() {
		return duration;
	}

	public class TextureNote {
		private int m_pitchNo;
		private int m_tick;
		private int m_duration;
		private int m_velocity;

		public TextureNote(int pitch_no, int velocity, int duration, int tick) {
			m_pitchNo = pitch_no;
			m_tick = tick;
			m_duration = duration;
			m_velocity = velocity;
		}

		public int getPitchNo() {
			return m_pitchNo;
		}

		public int getRelativeTick() {
			return m_tick;
		}

		public int getDuration() {
			return m_duration;
		}

		public void setPitchNo(int pitchNo) {
			m_pitchNo = pitchNo;
		}

		public void setM_tick(int tick) {
			m_tick = tick;
		}

		public void setM_duration(int duration) {
			m_duration = duration;
		}

		public int getVelocity() {
			return m_velocity;
		}

		public void setVelocity(int velocity) {
			m_velocity = velocity;
		}

	}
}
